package com.yz.lzq.liwushuo.ui.webview.home;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.Window;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;

import com.yz.lzq.liwushuo.R;

import butterknife.Bind;
import butterknife.ButterKnife;

public class HomeWebActivity extends AppCompatActivity {


    @Bind(R.id.webView_showContent)
    WebView webViewShowContent;
    @Bind(R.id.activity_show_content)
    FrameLayout activityShowContent;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_web_home);
        ButterKnife.bind(this);
        initView();
    }

    private void initView() {
        Intent intent = getIntent();
        String[] stringses = intent.getStringArrayExtra("strings");
        Log.i("tag", "------->>>>>>initView: " + stringses[0]);

        webViewShowContent.getSettings().setJavaScriptEnabled(true);
        webViewShowContent.loadUrl(stringses[0]);
        webViewShowContent.setWebViewClient(new WebViewClient() {
            //强制使用web view加载网页
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                view.loadUrl(url);
                return true;
            }
        });
    }

}
